package com.pzl.expandableactionbar;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
import android.widget.ListView;
import android.widget.Toast;

import com.pzl.library.ExpandableActionBar;

public class MainActivity extends AppCompatActivity implements ExpandableActionBar.IOnActionBtnClick{
    private final String TAG = "MainActivity";
    private ListView listView;
    private ListViewAdapter adapter;
    private ExpandableActionBar eab;


    private void initView() {
        listView = (ListView) findViewById(R.id.listview);
        eab = (ExpandableActionBar) findViewById(R.id.eab);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        adapter = new ListViewAdapter(this);
        listView.setAdapter(adapter);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }

        eab.setMainTitle("账户名称",5,8);
        eab.setSubTitle("ID.e342r34",4);
        eab.setBgResource(R.drawable.bg_big,ExpandableActionBar.TYPE_FIX_WIDTH_AT_END);
        eab.registerActionBtnListener(this);
    }

    @Override
    public void onLeftClick() {
        Toast.makeText(this,"onLeftClick",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRightClick() {
        Toast.makeText(this,"onRightClick",Toast.LENGTH_SHORT).show();
    }
}
